package tool

import implicits.Implicits._

import java.io.File

/**
 * Created by yz on 23/12/2021
 */
object Tool {

  val dbName = "modeling_lib"
  val rScript = "Rscript".condaPath()
  val playPath = getJarPath
  val linuxPath = playPath + s"/${dbName}"
  val rPath = {
    val path = "C:\\workspaceForIDEA\\modeling\\rScripts"
    val linuxPyPath = linuxPath + "/rScripts"
    if (new File(path).exists) new File(path) else new File(linuxPyPath)
  }
  val configDir = {
    val path = "C:\\workspaceForIDEA\\modeling\\config"
    val linuxPyPath = linuxPath + "/config"
    if (new File(path).exists) new File(path) else new File(linuxPyPath)
  }

  def getJarPath={
    new File(getClass.getProtectionDomain.getCodeSource.getLocation.toURI).getParentFile.getPath
  }

  def isWindows = {
    System.getProperty("os.name") match {
      case x if x.contains("Windows") => true
      case _ => false
    }
  }

}
